﻿using System.Web.Mvc;

namespace MvcShop.MVC.Areas.Admin
{
    public class AdminAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Admin";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
               "Admin_UserOrders",
               "Admin/{controller}/{action}/{billNo}",
               new { controller = "OrdersManage", action = "ManageOrder", billNo = "" },
               new { controller = @"^\w+", action = @"^\w+", billNo = @"^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$" }
           );

            context.MapRoute(
                "Admin_userAction",
                "Admin/{controller}/{action}/{id}/{asz}",
                new { action = "AddControllerActionRole", id = "" },
                new { id = @"\d+",asz=@"\w+" }
            );
            
            context.MapRoute(
                "Admin_default",
                "Admin/{controller}/{action}/{id}",
                new { action = "Index", id = "" },
                new { action = @"^\w+", id = @"\d+" }
            );

            context.MapRoute(
               "Admin_UserAdmin",
               "Admin/{controller}/{action}",
               new { controller = "Admin", action = "ManageIndex" }
           );
        }
    }
}
